import requests

# 在json文件 标头headers里面找到url
# url='https://xueqiu.com/statuses/hot/listV2.json?since_id=-1&max_id=-1&size=15'
main_url= 'https://xueqiu.com'

headers = {
    'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'

}

resp_main = requests.get(main_url,headers=headers)
cookies= resp_main.cookies
print(resp_main)
print(dict(cookies))
# 在json文件 标头headers里面找到异步加载数据的url
url='https://xueqiu.com/statuses/hot/listV2.json?since_id=-1&max_id=-1&size=15'
# 在主页中得到cookie赋值给异步请求的url
resp= requests.get(url,headers=headers,cookies=cookies)
print(resp)